"""
概率论5.2-中心极限定理

"""
import numpy as np
from scipy.stats import binom
import matplotlib.pyplot as plt

y = []
n = 100
for i in range(1000):
    # 二项分布
    r = binom.rvs(n, 0.3)
    rsum = np.sum(r)
    z = (rsum - n * 0.3) / np.sqrt(n * 0.3 * 0.7)
    y.append(z)

plt.hist(y, color='grey')
plt.show()
